package cn.shuo.app.model;

import lombok.Data;

@Data
public class ResultVo {

    /**
     * status_code : 200
     * message : 成功
     * current_page : 1
     * data : []
     */

    private static final String SUCCESS = "成功";
    private static final String FAILURE = "失败";

    private int status_code;
    private String message;
    private int current_page;
    private Object data;

    public static ResultVo ok( Object data){
        return ResultVo.ok(SUCCESS,data);
    }


    public static ResultVo ok(){
        return ResultVo.ok(SUCCESS);
    }


    public static ResultVo ok(String msg, Object data){
        return ResultVo.ok(200,msg,data);
    }

    public static ResultVo ok(int code,String msg, Object data){
        ResultVo resultVo = new ResultVo();
        resultVo.setStatus_code(code);
        resultVo.setMessage(msg);
        resultVo.setData(data);
        return resultVo;
    }

    public static ResultVo fail(){
        return ResultVo.fail(FAILURE);
    }

    public static ResultVo fail(String msg){
        return ResultVo.fail(msg,null);
    }

    public static ResultVo fail(String msg,Object data){
        return ResultVo.fail(404,msg,data);
    }

    public static ResultVo fail(int code ,String msg, Object data){
        ResultVo resultVo = new ResultVo();
        resultVo.setStatus_code(code);
        resultVo.setMessage(msg);
        resultVo.setData(data);
        return resultVo;
    }

//    public static ResultVo ok(){
//        return
//    }
}
